﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using WooCoo.DataPortal;
using WooCoo.Portal.Contracts;
using WooCoo.Web.MVC;

namespace WooCoo.Portal.Web.Areas.Support.Controllers
{
    public class ResourceController : AuthController
    {
        //
        // GET: /Support/Resource/
        public ActionResult Index()
        {
            return View();
        }

        public ActionResult GetAll()
        {
            var data = DataPortalClient.Default.CreateQuery<SysResource>().ToList();
            return Json(data, JsonRequestBehavior.AllowGet);
        }

        public JsonResult GetResource(int id)
        {
            var data = DataPortalClient.Default.CreateQuery<SysResource>().Where(o => o.ID == id).FirstOrDefault();
            return Json(data,JsonRequestBehavior.AllowGet);
        }
	}
}